import { Column, Entity, PrimaryGeneratedColumn } from "typeorm";

@Entity("kline", { schema: "qmt-basic" })
export class Kline {
  @PrimaryGeneratedColumn({ type: "int", name: "id" })
  id: number;

  @Column("varchar", { name: "code", comment: "股票代码", length: 20 })
  code: string;

  @Column("bigint", {
    name: "date",
    comment: "日期  年月日（东财K线数据 索引0）",
  })
  date: string;

  @Column("float", {
    name: "open",
    comment: "开盘价 （东财K线数据 索引1）",
    precision: 12,
  })
  open: number;

  @Column("float", {
    name: "close",
    comment: "收盘价（东财K线数据 索引2）",
    precision: 12,
  })
  close: number;

  @Column("float", {
    name: "high",
    comment: "最高价（东财K线数据 索引3）",
    precision: 12,
  })
  high: number;

  @Column("float", {
    name: "low",
    comment: "最低价（东财K线数据 索引4）",
    precision: 12,
  })
  low: number;

  @Column("float", {
    name: "volume",
    comment: "成交量（东财K线数据 索引5）",
    precision: 12,
  })
  volume: number;

  @Column("float", {
    name: "amount",
    comment: "成交额（东财K线数据 索引6）",
    precision: 12,
  })
  amount: number;

  @Column("float", {
    name: "amplitude",
    comment: "振幅（东财K线数据 索引7）振幅是最高价和最低价的幅度",
    precision: 12,
  })
  amplitude: number;

  @Column("float", {
    name: "chg",
    comment: "涨跌幅（东财K线数据 索引8）",
    precision: 12,
  })
  chg: number;

  @Column("float", {
    name: "change",
    comment: "涨跌额（东财K线数据 索引9）",
    precision: 12,
  })
  change: number;

  @Column("float", {
    name: "turn",
    comment: "换手率（东财K线数据 索引10）",
    precision: 12,
  })
  turn: number;
}
